/***************************************************************************
 *   Copyright (C) 2006 by Harish Kukreja                                  *
 *   harish.kukreja@gmail.com                                              *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/

//
// C++ Interface: fields
//
// Description: Headers for built-in physical Fields commonly used in Physiks.
//
//
// Author: Harish Kukreja <harish.kukreja@gmail.com>, (C) 2006
//
// Copyright: See COPYING file that comes with this distribution
//
//

#ifndef _FIELDS_H_
#define _FIELDS_H_

#include <physiksbase/physiksvector.h>
#include <gsl/gsl_const_mksa.h>
#include <gsl/gsl_math.h>

namespace PhysiksBase {

class PhysicalObject;

using PhysiksBase::Vector;


/** A base class for all fields in Physiks. */
class Field {};

/** A common interface for all vector fields. */
class VectorField : public Field {
    public:
        /** \brief Returns the corresponding output vector, given a position in Rn */
        virtual Vector operator()(const Vector &) const = 0;
};

/** A common interface for all scalar fields. */
class ScalarField : public Field {
    public:
        /** \brief Returns the corresponding output scalar, given a position in Rn */
        virtual double operator()(const Vector &) const = 0;
};


/** Built-in magnetic (B) field.    */
class MagneticField : public VectorField {};

/** Built-in electric (E) field.    */
class ElectricField : public VectorField {};

/** Built-in force (F) field.   */
class ForceField : public VectorField {
    public:
        virtual Vector operator()(const Vector &) const = 0;
};

/** Built-in acceleration field.    */
class AccelerationField : public VectorField {};

/** Built-in velocity field.    */
class VelocityField : public VectorField {};


/** Built-in representation of a Newtonian gravitational acceleration field.   */
class NewtonianGravitationalField : public AccelerationField {
    private:
        
        /** \brief The center of the field, from/to which force vectors emanate.   */
        PhysicalObject *center;
        
    public:
        
        /** \brief Constructor accepting the object to be bound to as the sole parameter.
         * \param   obj the object at the center of the field, responsible for the attractive
         *              force.  */
        NewtonianGravitationalField(PhysicalObject &obj);
        
        /** \brief  Implementation of the acceleration field function.
         * \param   pos a position in Rn
         * \return  the <b>acceleration</b> vector corresponding to the given position  */
        Vector operator()(const Vector &pos) const;
        
        virtual ~NewtonianGravitationalField();
};

/** Built-in representation of a Coulomb electric acceleration field.   */
class CoulombAccelerationField : public AccelerationField {
    private:
        
        /** \brief The center of the field, from/to which force vectors emanate.   */
        PhysicalObject *center;
        
    public:
        
        
        /** \brief Constructor accepting the object to be bound to as the sole parameter.
         * \param   obj the object at the center of the field, responsible for the attractive
         *              force.  */
        CoulombAccelerationField(PhysicalObject &obj);
        
        /** \brief  Implementation of the acceleration field function.
         * \param   pos a position in Rn
         * \return  the <b>acceleration</b> vector corresponding to the given position  */
        Vector operator()(const Vector &pos) const;
        
        virtual ~CoulombAccelerationField();
};

}   // End of namespace PhysiksBase

#endif
